<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"  indent="yes" version="4.0"/>
    <xsl:template match="/">
        <table class="table">
            <thead>
                <th>.No</th>
                <th>ID</th>
                <th>Tiêu đề</th>
                <th>Người đăng</th>
                <th>Ngày đăng</th>
                <th>Thao tác</th>
            </thead>
            <tbody>
                <xsl:apply-templates />
            </tbody>
        </table>
    </xsl:template>
    <xsl:template match="posts">
        <xsl:for-each select="post">
            <tr>
                <td>
                    <xsl:number value="position()" format="1"  />
                </td>
                <td>
                    <xsl:value-of select="id"/>
                </td>
                <td>
                    <xsl:value-of select="title"/>
                </td>
                <td>
                    <xsl:value-of select="poster"/>
                </td>
                <td>
                    <xsl:value-of select="postedDate"/>
                </td>
                <td>
                    <a>
                        <xsl:attribute name="href">AdminController?btAction=approvePost&amp;pID=<xsl:value-of select="id"/></xsl:attribute>
                        <span>Duyệt</span>
                    </a>
                    |
                    <a>
                        <xsl:attribute name="href">AdminController?btAction=deletePostXML&amp;pID=<xsl:value-of select="id"/></xsl:attribute>
                        <span>Xóa</span>
                    </a>
                    |
                    <a>
                        <xsl:attribute name="href">AdminController?btAction=viewPostXML&amp;pID=<xsl:value-of select="id"/></xsl:attribute>
                        <span>Chi tiết</span>
                    </a>
                </td>
            </tr>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
